package model;

//gameobjektumokat hoz letre
public class GameObjectFactory {
	Game game;
	static int id;
	//a bemeno parameter fuggvenyeben objektumokat hoz letre
	public GameObjectFactory(Game pgame){
		game=pgame;
		id=1;
	}
	
	//a teszteleshez letre kell hoznunk szagokat
	//a string tomb tartalmazza a koordinatakat is
	public GameObject createGameObject(String[] result){
		//ha szagot akarunk letrehozni
    	 	if(result[0].equals("makeAntOdor")){
    	 		AntOdor ao=new AntOdor(game);
    	 		String[] tmp=result[1].split(",");
    	 		ao.loc_x=Double.parseDouble(tmp[0]);
    	 		ao.loc_y=Double.parseDouble(tmp[1]);
    	 		ao.ID=id++;
	    		return ao;
	    		 
	    	 }
    	 	return null;
    	 	
	}
	
	//a string fuggvenyeben gameobjecteket hozunk letre
	//az ID-vel azonositjuk
	public GameObject createGameObject(String name) {
		
    	 	if(name.equals("LittleAnt")){
    	 		LittleAnt la=new LittleAnt(game);
    	 		la.setID(id++);
    	 		game.gameObjects.add(la);
	    		 return la;
	    		 
	    	 }
    	 	if(name.equals("BigAnt")){
    	 		BigAnt ba=new BigAnt(game);
    	 		ba.setID(id++);
    	 		game.gameObjects.add(ba);
	    		 return ba;
	    		 
	    	 }
    	 	if(name.equals("Hedgehog")){
    	 		HedgeHog h=new HedgeHog(game);
    	 		h.setID(id++);
	    		 return h;
	    		 
	    	 }
    	 	if(name.equals("AntOdor")){
    	 		AntOdor ao=new AntOdor(game);
    	 		ao.setID(id++);
	    		 return ao;
	    		 
	    	 }
    	 	return null;
	}
	

}
